#ifndef _GRO_FONT_H__
#define _GRO_FONT_H__

#include <map>
#include <vector>

namespace GRO
{
    
    
class Gui;

struct GRO_FontID
{
    private:
    unsigned int id;
    
    public:
    
    GRO_FontID()
        : id(0)
    {}
    
    GRO_FontID(unsigned int id)
        : id(id)
    {}
    
    void setValue(unsigned int id)
    {
        this->id = id;
    }
    
    unsigned int getValue() const
    {
        return id;
    }
    
    bool operator<(const GRO_FontID& fontID) const
    {
        return (id < fontID.id);
    }
    
    bool operator==(const GRO_FontID& fontID) const
    {
        return (id == fontID.id);
    }
};


    /*
    GRO_Font is the abstraction for font libraries that GRO_Gui can use.
    */

    class GRO_Font
    {
    public:
        GRO_FontID id;
    
        GRO_Font()
        {}

        virtual ~GRO_Font()
        {}
        
        GRO_FontID getID()
        {
            return id;
        }

        virtual void draw(int x, int y, const char* formatted_text, ...)
        {}

        virtual void drawCenter(int x, int y, const char* formatted_text, ...)
        {}

        virtual void drawRight(int x, int y, const char* formatted_text, ...)
        {}

        virtual int getHeight(const char* formatted_text = 0, ...)
        {
            return 0;
        }

        virtual int getWidth(const char* formatted_text, ...)
        {
            return 0;
        }

        virtual void setSpacing(int LetterSpacing)
        {}

        virtual int getSpacing()
        {
            return 0;
        }

        virtual void setLineSpacing(int LineSpacing)
        {}

        virtual int getLineSpacing()
        {
            return 0;
        }

        virtual int getBaseline()
        {
            return 0;
        }

        virtual int setBaseline(int Baseline = -1)
        {
            return 0;
        }

        virtual int getAscent(const char character)
        {
            return 0;
        }

        virtual int getAscent(const char* formatted_text = 0, ...)
        {
            return 0;
        }

        virtual int getDescent(const char character)
        {
            return 0;
        }

        virtual int getDescent(const char* formatted_text = 0, ...)
        {
            return 0;
        }

        virtual int getMaxWidth()
        {
            return 0;
        }

    };
    
    
    class FontMap
    {
        private:
        GRO_FontID defaultFont;
        std::vector<GRO_FontID> indexedFonts;
        std::map<GRO_FontID, GRO_Font*> fonts;
        
        public:
        
        FontMap();
        ~FontMap();
        
        
        void setIndexedFont(unsigned int i, const GRO_FontID& id);
        GRO_Font* getIndexedFont(unsigned int i);
        
        GRO_FontID add(GRO_Font* font);
        GRO_Font* get(const GRO_FontID& id);
        GRO_Font* remove(const GRO_FontID& id);
        
        GRO_Font* getDefault();
    };
    
    FontMap* getFontMap();
    void setFontMap(FontMap* fontMap);
}
    
    
#endif
